<?php

	//contains login information
	define('username','root');
	define('localhost','localhost');
	define('password', 'root01');
	define('database', 'restaurant');

	//table name constraints
	$tables = array (
		'drinks' => 'Drinks',
		'base' => 'BaseIngredients',
		'build' => 'BuildIngredients',
		'meat' => 'MeatIngredients',
	); 

	//query submission
	function set($table) {

		//store query's result
		$result = mysql_query("SELECT * FROM $table") or 
			die(mysql_error());

		//store results in an associative array
		while($items = mysql_fetch_assoc($result))
			$rows[$items['name']] = $items; //make sure indice is name

		return $rows; //contains the newly formed associative array
	} //conclude query submission

	//constructor starts with a query
	function sql_load() {
		global $tables; //recognize tables as global

		//connect and authenticate
		mysql_connect(localhost,username,password) or
			die(mysql_error()); 
		mysql_select_db(database); //select defined database

		//collect results from tables
		foreach($tables as $index => $value) 
			$master[$index] = set($value);  //load array into variable

		//array containing all arrays
		return $master;
	} //conclude constructor

?>
